<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Order extends Model
{
    public $timestamps = false;
    /**
     * 获取查询字段
     *
     * @var array
     */
    protected $fillable = [
        'id', 'u_id', 'information', 'amount', 'note', 'picture', 'create_at', 'is_delivery', 'logistics_company',
        'tracking_number', 'is_receiving', 'is_trial', 'is_recheck', 'is_remit', 'is_cancel'
    ];

    // 表示 create_time 是一个日期字段
    protected $dates = [];

    /**
     * 隐藏字段
     *
     * @var array
     */
    protected $hidden = [];


    /**
     * 模型关联 —— 用户
     */
    public function user()
    {
        return $this->belongsTo(User::class, 'u_id', 'id');
    }

    public function phone()
    {
        return $this->hasMany(OrderPhone::class, 'o_id');
    }
}
